# Maintainer: AndyRTR <andyrtr@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>

pkgname=xorg-fonts-type1
pkgver=1.0.4
epoch=1
pkgrel=1
pkgdesc="X.org Type1 fonts"
arch=(any)
license=('custom')
url="https://xorg.freedesktop.org/"
makedepends=('xorg-util-macros' 'xorg-mkfontscale')
source=(${url}/releases/individual/font/font-adobe-utopia-type1-1.0.5.tar.xz{,.sig}
        ${url}/releases/individual/font/font-bh-type1-${pkgver}.tar.xz{,.sig}
        ${url}/releases/individual/font/font-bitstream-type1-${pkgver}.tar.xz{,.sig}
        ${url}/releases/individual/font/font-ibm-type1-${pkgver}.tar.xz{,.sig}
        ${url}/releases/individual/font/font-xfree86-type1-1.0.5.tar.xz{,.sig})
sha512sums=('e30f4c7702f47a3a42206975fbcfec058317681956d246411e50e372b669bdc875c5d7fe28bad7d298bc61b71a997c7836fb6ac16effd223a96723a6e9ece649'
            'SKIP'
            '06b0752b67a8109c0173be2ad4b9623940bc0c55e5854dddfd74c4abf96b4ab2f0e4446325c4d6971011231176f87a06b55e906b7472f371b9824d89e3cbee7f'
            'SKIP'
            'f09d60abb88c9be6227c57f5519f08e5e3c59c916183d32a512d3c2ace0047eaad2b377c3725c8987e8b4c55468eb7821322ff5447f000d4c2be6cb909f6219b'
            'SKIP'
            '42ebc9f1b0726a9a1bf3d7c8a3b7102a448e7c6ff0c5ac1dd8a4861bf51c344ddb2e077df41b86e3e896100371a33f997d6df834b4d64b835d81a36dfddfbce3'
            'SKIP'
            '0a92d911269c5c4d815dfb617bfcc57c3bd54e4cd308eba87f9ec49851369d99dea61950dbd6cdc0f85db92c0c24055da88063b083b4b0cafb3315051bb650ed'
            'SKIP')
validpgpkeys=('4A193C06D35E7C670FA4EF0BA2FB9E081F2D130E') # "Alan Coopersmith <alan.coopersmith@oracle.com>"

build() {
  cd "${srcdir}"
  for dir in *; do
    if [ -d "${dir}" ]; then
      pushd "${dir}"
      ./configure --prefix=/usr \
        --with-fontdir=/usr/share/fonts/Type1
      make
      popd
    fi
  done
}

package() {
  cd "${srcdir}"
  install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
  for dir in *; do
    if [ -d "${dir}" ]; then
      pushd "${dir}"
      make DESTDIR="${pkgdir}" install
      install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.${dir%-*}"
      popd
    fi
  done
  rm -f "${pkgdir}"/usr/share/fonts/Type1/fonts.*
}
